package tree.leetcode_617_easy;

import java.util.Deque;
import java.util.LinkedList;

public class DFSRecursion {
    public static void main(String[] args) {
        TreeNode t1 = null;
        TreeNode t2 = null;
        mergeTrees(t1,t2);
    }
    public static TreeNode mergeTrees(TreeNode t1, TreeNode t2){
        if(t1 == null || t2 == null){
            return t1 != null ? t1 : t2;
        }
        TreeNode root = new TreeNode(t1.val + t2.val);
        root.left = mergeTrees(t1.left,t2.left);
        root.right = mergeTrees(t1.right,t2.right);
        return root;
    }
}
